const { MongoClient } = require('mongodb');

const url = 'mongodb://124.70.181.91:10010';
const client = new MongoClient(url);

const dbName = 'student';

async function main(table) {
    await client.connect();
    console.log('Connected successfully to server');
    const db = client.db(dbName);
    const collection = db.collection(table);
    return collection;
}

module.exports = main;